package com.infore.siteManagement.repository.equipment;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.infore.siteManagement.entity.equipment.EquipmentSample;

@Repository
public interface IEquipSampleRepository
		extends JpaRepository<EquipmentSample, String>, JpaSpecificationExecutor<EquipmentSample> {

	List<EquipmentSample> findByIdIn(List<String> ids);

	List<EquipmentSample> findByStationMn(String mn);
	
	@Query(value="select t.* from EQUIPMENT_SAMPLE t left join station s "
			+ "on t.station_Mn = s.station_mn where s.STATION_ID = :stationId",nativeQuery=true)
	List<EquipmentSample> findByStationStationId(@Param("stationId")String stationId);
	
//	/**备品备件查询仪器名称站点编号**/
//	@Query(value="select s.station_name,s.station_id,m.equipment_name,s.station_mn,t.equip_model "
//			+ "from EQUIPMENT_SAMPLE t "
//			+ "left join station s on s.station_mn = t.station_mn "
//			+ "left join equipment_model m on t.equipment_model_id = m.id " + 
//			" where s.station_id in (:stationIds)",nativeQuery=true)
//	List<Map<String, Object>> queryBystauionId(@Param("stationIds")List<String> stationIds);
}
